home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Whiteline: delta
/
whiteline CD Series - delta.iso
/
dl_serie
/
updates
/
159
/
source
/
beispiel.c
next >
Wrap
C/C++ Source or Header
|
1995-11-25
|
2KB
|
112 lines
#include <stdio.h>
#include <aes.h>
#include <tos.h>
#include <string.h>
#include "fdmproto.h"
#include "slectric.h"
int GetCookie (long cookie, void *value)
{
long old_stack, *jar;
old_stack = Super (NULL);
jar = *((long **) 0x5a0l);
Super ((void *) old_stack);
if (jar)
{
while (*jar)
{
if (*jar == cookie)
{
if (value)
*(long *)value = *++jar;
return 1;
}
jar += 2;
}
}
return 0;
}
void GetCurrPath (char *p, char *ext)
{ int drv;
drv = Dgetdrv ();
*p++ = drv + 'A';
*p++ = ':';
Dgetpath (p, 0);
p += strlen (p);
if (-1[p] != '\\')
*p++ = '\\';
strcpy (p,ext);
}
int main (void)
{
int ok;
char buf[sizeof (Fdm_Str) + 256], file[128] = "", alert[512];
Fdm_Str *fdm = (Fdm_Str *)buf;
char *path = buf + sizeof (Fdm_Str);
SLCT_STR *slct_str;
if (appl_init () < 0) return -1;
if (!GetCookie ('FSEL',&slct_str) || slct_str->version < 0x200)
{
form_alert (1, "[1][Kein Freedom da.][Ok]");
goto tschuessi;
}
GetCurrPath (path, "*.*");
strcpy (strchr (path,0)+1, "?Fdm");
memset (fdm,0,sizeof (Fdm_Str));
fdm->magic = '?Fdm';
fdm->maxsel = 5;
wind_update (BEG_UPDATE);
fsel_exinput (path,file,&ok,"*Der* Fileselektor");
wind_update (END_UPDATE);
if (fdm->magic != '!Fdm')
{
if (ok)
sprintf (alert,
"[0][Freedom-Unterstützung fehlgeschlagen!|"
"Pfad und ausgewähltes File:|"
"%s|%s|][Ok]",path,file);
else
sprintf (alert,
"[0][Freedom-Unterstützung fehlgeschlagen!|"
"Abbruch gedrückt!|][Ok]");
}
else
{
int msg[8];
char *files;
do
evnt_mesag (msg);
while (msg[0] != FILE_SELECTED);
strcpy (path, *(char **)&msg[4]);
files = *(char **)&msg[6];
ok = files != NULL;
if (ok)
sprintf (alert,
"[0][Freedom-Unterstützung erfolgreich!|"
"Pfad und ausgewählte Files:|"
"%s|%s|][Ok]",path,files);
else
sprintf (alert,
"[0][Freedom-Unterstützung erfolgreich!|"
"Abbruch gedrückt!|][Ok]");
}
form_alert (1,alert);
tschuessi:
appl_exit ();
return 0;
}